package com.example.springboot.controller;

import com.example.springboot.common.Result;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 功能：
 * 作者：by 压哨
 * 日期：20250328
 */
@RestController
@RequestMapping("/web")
public class WebController {
    @GetMapping("/hello")
    public Result hello(String name){
        return Result.success(name);
    }
//    public String hello(){
//        return "Hello World!!!";
//    }
    @PostMapping("/post")   //新增数据
    public Result post(@RequestBody OBJ obj){
        System.out.println(obj.getName() == null ?  "是空" : obj.getName().isEmpty());
        return Result.success(obj);
    }

    @PutMapping("/put")  // 更新数据
    public Result put(@RequestBody OBJ obj){
        return Result.success(obj);
    }
    @DeleteMapping("/delete/{id}")  // 删除数据
    public Result delete(@PathVariable Integer id){
        return Result.success(id);
    }

    @DeleteMapping("/delete1")  // 删除数据
    public Result delete1(@RequestBody List<Integer> ids){
        return Result.success(ids);
    }

}
